package com.service.impl;

import java.util.HashMap;
import java.util.Map;

import com.bean.Admin;
import com.dao.AdminDao;
import com.dao.impl.AdminDaoImpl;
import com.service.AdminService;

public class AdminServiceImpl implements AdminService {
	
	private AdminDao adminDao = new AdminDaoImpl();
	@Override
	public Map<String, Object> login(String account, String password) {
		Map<String, Object> result = new HashMap();
		Admin admin = adminDao.selectAdmin(account, password);
		if(admin != null) {
			//登录成功
			result.put("loginAdmin", admin);
		}else {
			admin = adminDao.selectAdminByAccount(account);
			if(admin != null) {
				result.put("msg","密码错误");
			}else {
				result.put("msg","用户名不存在");
			}
		}
		return result;
	}

}
